import React,{useState,useEffect,memo,useCallback} from 'react'

const Child = memo(function({count}){
    console.log('child render')
    return (
        <div>
            <h2>{count}</h2>
        </div>
    )
})
export default function Memo() {
    const[n,setN] = useState(0)
    useEffect(()=>{
        setInterval(()=>{
            setN(Math.random())
        },2000)
    },[])
    const cb =useCallback(()=>{

    },[])
  return (
    <div>
        <h2>{n}</h2>
        <Child count={2} callback={cb} />
    </div>
  )
}
